<template>
  <div>
    <VNav></VNav>
    <div class="flex j-s item" v-for="(item, index) in list" :key="index">
      <div>
        <img :src="item.pic" alt="" />
      </div>
      <div class="content">
        <div class="title">{{ item.title }}</div>
        <div class="flex j-s time">
          <div>{{ item.time }}</div>
          <div>{{ item.src }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import VNav from "@/components/vNav.vue";
import axios from "axios";
export default {
  name: "index",
  components: {
    VNav,
  },
  data() {
    return {
      list: [],
    };
  },
  created() {
    this.showdata();
  },
  methods: {
    async showdata() {
      const { data: res } = await axios({
        method: "GET",
        url: "./news.json",
      });
      this.list = res.result.list;
      console.log(res);
    },
  },
};
</script>

<style lang="scss" scoped>
.item {
  padding: 10px;
  border-bottom: 1px solid #ccc;
  img {
    width: 100px;
    height: 80px;
  }
  .content {
    margin-left: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .title {
      color: #666;
      font-size: 15px;
    }
    .time {
      font-size: 12px;
      color: #666;
    }
  }
}
</style>